package com.tx.websocket.demo.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.tx.websocket.demo.dao.DepartmentDao;
import com.tx.websocket.demo.model.Department;
import com.tx.websocket.demo.service.DepartmentService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
public class DepartmentServiceImpl implements DepartmentService {

    @Resource
    private DepartmentDao departmentDao;

    @Transactional
    @Override
    public Integer addDepartment(Department department) {
        return departmentDao.addDepartment(department);
    }

    @Transactional(readOnly = true)
    @Override
    public List<Department> listDepartment(Department department) {
        return departmentDao.listDepartment(department);
    }

    @Transactional(readOnly = true)
    @Override
    public Department getDepartmentByPrimaryKey(Long id) {
        return departmentDao.getDepartmentByPrimaryKey(id);
    }

    @Transactional
    @Override
    public Integer delDepartmentByPrimaryKey(Long id) {
        return departmentDao.delDepartmentByPrimaryKey(id);
    }

    @Transactional
    @Override
    public Integer updateDepartment(Department department) {
        return departmentDao.updateDepartment(department);
    }

}
